﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Chefbook.DataObjects;
using System.Globalization;
using Chefbook.DataAccessLayer;

namespace Chefbook.UserActions
{
    public class RemoveRecipeFromCategoryAction : UserActionBase
    {
        private Recipe recipeToRemove;
        private Category categoryToRemoveFrom;

        public RemoveRecipeFromCategoryAction(Recipe recipeToRemove, Category categoryToRemoveFrom)
        {
            this.recipeToRemove = recipeToRemove;
            this.categoryToRemoveFrom = categoryToRemoveFrom;
        }

        public override void DoAction()
        {
            base.DoAction();
            categoryToRemoveFrom.RemoveRecipe(recipeToRemove);
        }

        public override void UndoAction()
        {
            base.UndoAction();
            categoryToRemoveFrom.AddRecipe(recipeToRemove);
        }

        public override string ToString()
        {
            return string.Format(CultureInfo.CurrentUICulture, "Remove Recipe '{0}' from Category '{1}'", recipeToRemove, categoryToRemoveFrom);
        }
    }
}
